<?
//<meta http-equiv="content-type" content="text/html; charset=utf-8">
include "head.php";
?>
<script language="javascript">
function process(url) {
	if(confirm('are you sure?')) {
		window.open(url, "processing", "status=no,toolbar=no,scrollbars=no,width=640,height=480");		
	} 
}
</script>
<p align="right"><a href="setup.php">Setup</a></p>
<p align="center">&nbsp;</p>
<p align="center"><strong>UMLS Metathesaurus</strong> (2013AB)</p>
<form name="form1" method="get" action="search_umls.php">
<p align="center">
<input type="radio" name="query_type" id="query_type1" value="string" checked="checked" />
<label for="query_type1">String</label>
<input type="radio" name="query_type" id="query_type2" value="cui" />
<label for="query_type2">CUI</label>&nbsp;
<input type="text" name="query_value" style="width:300px">
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<p align="center">&nbsp;</p>
<div class="column">
<p><u>Concept hierarchy</u></p>
<ol>
<?
$query = "select * from {$table_prefix}concept_tree where depth = 1 order by str"; 
$result = mysql_query($query) or die("\n<br>Query:$query\n<br>Error:".mysql_error());
while( $row = mysql_fetch_array($result) ) {
	echo sprintf("
	<li><a href='concept_viewer.php?query_table=concept_tree&query_bcui=%s&'>%s</a> : %s</li>", $row['cui'], $row['str'], number_format($row['child_cnt'], 0, '.', ","));
}
?>
</ol>
</div>
<div class="column">
<?
$query = "select * from {$table_prefix}subset order by update_time desc";
$result = mysql_query($query) or die("\n<br>Query:$query\n<br>Error:".mysql_error());
$cnt = mysql_num_rows($result);
?>
<p><u>User defined subset</u> (<?=number_format($cnt, 0, '.', ",")?>)</p>
<ol>
<?
for ( $i = 0 ; $i < 25 && $row = mysql_fetch_array($result) ; $i++ ) {
	$subset = $row['subset'];
	echo "\n<li>
	<a target='_blank' href='concept_viewer.php?query_table=subset_concept_tree&query_subset=$subset&show_cui=1'>{$subset}</a> : 
	<a target='_blank' href='subset.php?query_subset=$subset'>edit</a> 
	<a target='_blank' href='search_core.php?table_name=ut_subset_concept_tree&query_subset=$subset'>raw</a> 
	</li>";
}
?>
</ol>
<?
$query = "select c.cui, c.str from {$table_prefix}temporary_concept t, {$table_prefix}concept c where t.cui = c.cui";
$result = mysql_query($query) or die("\n<br>Query:$query\n<br>Error:".mysql_error());
$cnt = mysql_num_rows($result);
?>
<p><u>Temporary Concept Repository</u> (<a title="total cui #" href="temporary_concept.php"><?=number_format($cnt, 0, '.', ",")?></a>)</p>
<ol>
<?
for ( $i = 0 ; $i < 25 && $row = mysql_fetch_array($result) ; $i++ ) {
	echo sprintf("
	<li><a href='concept_viewer.php?query_table=concept_tree&query_bcui=%s'>%s</a></li>", $row['cui'], $row['str']);
}
?>
</ol>
</div>
<div class="init-column"></div>
<?
include "tail.php"
?>